package o;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.StatFs;
import androidx.annotation.NonNull;
import com.huawei.appgallery.packagemanager.api.bean.ManagerTask;
import com.huawei.hmf.annotation.ApiDefine;
import java.io.File;
import java.util.List;
import java.util.Map;
import o.cof.a;

@ApiDefine(uri = cny.class)
public class cpz implements cny {
    private static float ˊ = 2.5f;

    public void ॱ(@NonNull Context context, @NonNull Map<String, PackageInfo> map) {
        new cqe().ˋ(context, map);
    }

    public void ˊ(@NonNull Context context, @NonNull String str) {
        ManagerTask ˊ = cpa.ˊ().ˊ(str);
        if (ˊ != null) {
            cpq.ˋ(ˊ);
            cpa.ˊ().ˎ(context, str);
        }
    }

    public void ˎ(@NonNull Context context) {
        for (ManagerTask ˋ : cpa.ˊ().ˏ()) {
            cpq.ˋ(ˋ);
        }
        cpa.ˊ().ॱ(context);
    }

    public boolean ˋ(Context context, String str, int i) {
        ManagerTask ˊ = cpa.ˊ().ˊ(str);
        return ˊ != null && ˊ.versionCode >= i;
    }

    public boolean ˎ(@NonNull Context context, long j) {
        try {
            StatFs statFs = new StatFs(context.getFilesDir().getPath());
            if (((float) (statFs.getAvailableBlocksLong() * statFs.getBlockSizeLong())) >= ((float) j) * ˊ) {
                return true;
            }
            return false;
        } catch (Throwable e) {
            Logger.ˋ("UninstalledApkManageImpl", "path error", e);
            return false;
        }
    }

    public boolean ˋ(@NonNull Context context, @NonNull String str) {
        long j = 0;
        ManagerTask ˊ = cpa.ˊ().ˊ(str);
        if (ˊ != null) {
            List<a> list = ˊ.apkInfos;
            if (list != null) {
                long j2 = 0;
                for (a aVar : list) {
                    j2 = new File(aVar.ˎ).length() + j2;
                }
                j = j2;
            }
        }
        return ˎ(context, j);
    }

    public List<ManagerTask> ˏ(@NonNull Context context) {
        return cpa.ˊ().ˏ();
    }
}
